/**
 * 
 */
package edu.cmu.cs.webapp.ioms.dao;

import java.util.List;
import java.util.Map;

import edu.cmu.cs.webapp.ioms.models.IOMSPackage;
import edu.cmu.cs.webapp.ioms.models.PurchaseOrder;

/**
 * @author Christian
 * 
 */
public interface OrderDAO {
	/**
	 * 
	 * @return
	 */
	public List<PurchaseOrder> getAllOrder() throws DataAccessException;

	/**
	 * 
	 * @param po
	 * @return
	 */
	public int addOrder(PurchaseOrder po) throws DataAccessException;

	/**
	 * Updates the order with the given order id
	 * 
	 * @param po
	 * @return
	 */
	public boolean updateOrder(PurchaseOrder po) throws DataAccessException;

	/**
	 * Deletes the order with the given order id
	 * 
	 * @param po
	 * @return
	 */
	public boolean deleteOrder(PurchaseOrder po) throws DataAccessException;

	/**
	 * Add the order with the associated items
	 * 
	 * @param po
	 * @return
	 * @throws DataAccessException
	 */
	public int addOrderItems(PurchaseOrder po) throws DataAccessException;

	/**
	 * Search orders with the given search criteria(using "AND" if multiple
	 * key-values are supplied)
	 * 
	 * @param criteria
	 *            - Possible key value of the search criteria:
	 *            {@link IOMSPackage#PURCHASE_ORDER__STATUS} order status
	 *            {@link IOMSPackage#PURCHASE_ORDER__ORDER_DATE} order date
	 *            range
	 *            {@link IOMSPackage#PURCHASE_ORDER__EXPECTED_SHIPPING_DATE}
	 *            shipping date range {@link IOMSPackage#CLIENT__FNAME} client
	 *            first name {@link IOMSPackage#CLIENT__LNAME} client last name
	 *            {@link IOMSPackage#CLIENT__EMAIL} client email
	 *            {@link IOMSPackage#CLIENT__CLIENT_ID} client id
	 *            {@link IOMSPackage#INGREDIENT__NAME}
	 *            {@link IOMSPackage#PRODUCT__PROD_NAME}
	 * @return orders that match the given search criteria
	 */
	public List<PurchaseOrder> searchOrders(Map<String, Object> criteria)
			throws DataAccessException;
}
